<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%--你--%>
<html>

	<head>

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title>仪器共享</title>

		<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">

		<meta name="description" content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。
">
		<!-- <link rel="stylesheet" href="new_css/header_footer.css?t=1"> -->
		<link rel="stylesheet" href="new_css/userCenter.css">
		<link rel="stylesheet" href="css/new_style.css">
<!-- 		<link rel="stylesheet" href="js" /> -->
		<script src="new_js/jquery-1.11.3.js"></script>
		<script src="js/jquery.pagination.min.js"></script>
		<!-- <script src="method/xhh/order.js"></script> -->

		<script>
		$(document).ready(function() {
			//loadOrderList();
			$("#addInfo").click(function(){
				$(location).attr('href', "lizisepuyi16");
				});
			$("#addTime").click(function(){
				$(location).attr('href', "add18");
				
				});
			$("#goInfoOrder").click(function(){
				$(location).attr('href', 'book_admin23');
				});
			$("#addtInfo").click(function(){
				$(location).attr('href', 'publishInstrument17');
				});
		    $("#iiInfo").click(function(){
				$(location).attr('href', 'yiqixinxiweihu15');
				});
			$("#serviceOrder").click(function(){
				$(location).attr('href', 'service_public24_1');
				});
			
			});
		</script>
		<script>
			$(function() {
				
				$('#front_header .header_wrap .right').hover(function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
					$('#front_header .header_wrap .right .out').show();
				}, function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
					$('#front_header .header_wrap .right .out').hide();
				});
				
				//-----
				$("#item2").mouseover(function(){
       $(".item2_ul").css("display","block");
});


$("#item2").mouseout(function(){
       $(".item2_ul").css("display","none");
});
				$("#item1").mouseover(function(){
				
       			$(".item1_ul").css("display","block");
				});


				$("#item1").mouseout(function(){
       			$(".item1_ul").css("display","none");
				});
				
				//----
//				$('#item2').on('mouseover',function() {
//					console.log("111111");
//					$('#item2_ul').css('display','block');
//				}
//				$('#item2').on('mouseout',function() {
//					$('#item2_ul').css('display', 'none');
//				}
				
				$('#sorts').on('mouseover', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon4.png');
				});
				$('#sorts').on('mouseout', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon5.png');
				});
				
				$('.mainList .content .left li').click(function(){
					$(this).addClass('selected').siblings().removeClass('selected');
				});
			});
			
		</script>
	</head>

	<body style="background:#fff;">
	<%@include file="/header2.jsp"%>
		<div class="mainList">
			<!--<div class="bNav">您的位置：首页><span>用户中心</span></div>-->
			<div class="content">
				<div class="left">
					<div class="title">仪器管理</div>
					<!--<div class="list_header">全部订单<img src="images/usercenter_icon.png" /></div>-->
					
						<div class="sun_title">日期</div>
						<div class="sun_option" id="timeOption">
							<select>
								<option value="1"  selected ="selected">全部</option>
								<option value="2" >本周</option>
								<option value="3" >本月</option>
							</select>
						</div>
						<div class="sun_a">
							<!-- <a onclick="loadOrderList()">查询</a> -->
							<a id="searchBtn">查询</a>
						</div>
						<!--<li class="selected">待确认</li>
						<li>待支付</li>
						<li>待实验</li>
						<li>已完成</li>
						<li>未评价</li>
						<li>个人资料</li>-->
				</div>
				<div class="right"> 
					<div class="title"><span>仪器预约订单</span></div>
					<div class="tab_header">
						<div class="item1">设备详情</div>
						<div class="item2"></div>
						<div class="item3">型号</div>
						<div class="item4">仪器负责人</div>
						<div class="item5">交易状态</div>
						<div class="item6">交易操作</div>
					</div>
					<div class="infoList">
						<ul id="orderList">
							<li>
								<div class="row1">
									<div>
										<span>2018-03-13 18:36:04 </span>
										<span>订单编号: 3232430800330166</span>
									</div>
									<div><img src="images/usercenter_icon2.png" /></div>
								</div>
								<div class="row2">
									<div class="tab1"><img src="images/usercenter_pic.png" /></div>
									<div class="tab2">高内涵筛选系统</div>
									<div class="tab3">operetta</div>
									<div class="tab4">张三</div>
									<div class="tab5">
										<p>待确认</p>
										<p>
											<a href="bookingOrderDetail24">查看详情</a>
										</p>
									</div>
									<div class="tab6">
										<div class="btn">
											<a href="bookingOrderDetail24">待支付</a>
										</div>
										<div class="time">还剩11:23:02</div>
									</div>
								</div>
							</li>
							<li>
								<div class="row1">
									<div>
										<span>2018-03-13 18:36:04 </span>
										<span>订单编号: 3232430800330166</span>
									</div>
									<div><img src="images/usercenter_icon2.png" /></div>
								</div>
								<div class="row2">
									<div class="tab1"><img src="images/usercenter_pic.png" /></div>
									<div class="tab2">高内涵筛选系统</div>
									<div class="tab3">operetta</div>
									<div class="tab4">张三</div>
									<div class="tab5">
										<p>待确认</p>
										<p>
											<a href="bookingOrderDetail24">查看详情</a>
										</p>
									</div>
									<div class="tab6">
										<div class="btn">
											<a href="bookingOrderDetail24">待支付</a>
										</div>
										<div class="time">还剩11:23:02</div>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="pageButton"></div><!--找个分页插件插入-->
			
		</div>


	<!--page-->
	<!-- <div class="myPage clearfix">
		<ul class="page" maxshowpageitem="5" pagelistcount="10" id="page"></ul>
	</div> -->
<div class="myPage clearfix">
				<!--currentpage="1" numbercount="100"-->
				<!-- <ul class="page" maxshowpageitem="5" pagelistcount="10"  id="page"></ul> -->
				<div id="pagination3" class="page fl"></div>
				<input type="text" id="allinfonumber" style="display:none"/>
			</div>
		
		<%@include file="/footer.jsp"%>
	<script src="js/common.js"></script>
	<script>
			//var sele=$("#timeOption option:selected").val();
			 function loadPage(sele){
   		 			//alert($("#useridoflogin").val());
   		 			//alert("yemian:"+orderStatus);
					$.ajax({
 						url :Server + "/orderRelevant/managerInsOrderPageList",
						//url :"http://localhost/orderRelevant/managerInsOrderPageList",
						data : {
							"limit":5,
							"offset":0,
							"sele":sele,
							"uid":$("#useridoflogin").val()
 							//"uid": "4d272484d5844be693c05443c4edd71e"
						},
						type : "POST",
						dataType: "JSON",
						success : function(data) {
							var pageNum=0;
							//alert(Math.ceil(Number(data.total/10)));
							/* if(Number==(data.total/10)<=(limit/10)){
								pageNum=Math.ceil(Number(data.total/10));
							}else{
								pageNum=Math.ceil(Number(data.total/10))+1;
							} */
							$("#pagination3").pagination({
								currentPage: 1,
								totalPage:Math.ceil(data.total/limit),
								isShow: true,
								count: 7,
								homePageText: "首页",
								endPageText: "尾页",
								prevPageText: "<上一页",
								nextPageText: "下一页>",
								callback: function(current) {
									now=$("#pagination3").pagination("getPage").current-1;
									insOrderCallback(limit,$("#pagination3").pagination("getPage").current-1,sele);
								}
							});
						}
					});
				}
				function insOrderCallback(limit,offset,sele){
					//alert(limit+","+offset+","+sele)
					$.ajax({
						type: 'GET',
						url:Server + "/orderRelevant/managerInsOrderPageList",
						//url:"http://localhost/orderRelevant/managerInsOrderPageList",
						//url:"http://localhost:8080/share_ins/orderRelevant/managerInsOrderPageList",
						dataType: 'json',
						data: {
							"limit":limit,
							"offset":offset,
							"sele":sele,
							"uid":$("#useridoflogin").val()
							//"uid": "4d272484d5844be693c05443c4edd71e"
						},
						success: function(data) {
							var html = "";
							var pattern = '<li>\
								<div class="row1">\
									<div>\
										<span>#0 </span>\
										<span>订单编号: #1</span>\
									</div>\
									<div><img class="delete" val="#13" src="images/usercenter_icon2.png"/></div>\
								</div>\
								<div class="row2">\
									<div class="tab1"><img src="#2" /></div>\
									<div class="tab2"><a href="productDetail5?id=#12">#3</a></div>\
									<div class="tab3">#4</div>\
									<div class="tab4">#5</div>\
									<div class="tab5">\
										<p>#6</p>\
										<p>\
											<a onclick="findOrder(#7)">查看详情</a>\
										</p>\
									</div>\
									<div class="tab6">\
										<div class="btn">\
											<a class="operationBtn" onclick="manageDo(#11)">#8</a>\
										</div>\
										<div class="time">还剩11:23:02</div>\
									</div>\
								</div>\
							</li>';
							for(var i = 0; i < data.rows.length; i++){
								var item = "";
								//var order = data[i];
								var Status = "";
								var Status1 = "";
								switch (data.rows[i].status)
								{
									case 0:
										Status = "订单待确定";
										Status1 = "确定";
										break;
									case 1:
										Status = "待支付";
										Status1 = "";
										break;
									case 5:
										Status = "已关闭";
										Status1 = "";
										break;	
									/* case 2:
										Status = "已支付";
										Status1 = "";
										break;
									case 3:
										Status = "待确定";
										Status1 = "确定";
										break;
									case 4:
										Status = "待试验";
										Status1 = "";
										break;
									case 5:
										Status = "已完成";
										Status1 = "评价";
										break;
									case 6:
										Status = "已评价";
										Status1 = "";
										break;
									case 7:
										Status = "已关闭";
										Status1 = "";
										break; */
								}
								item += pattern.replace("#0",new Date(data.rows[i].createTime).Format("yyyy-MM-dd hh:mm:ss") )
									.replace("#1", data.rows[i].number)
									.replace("#2", data.rows[i].insInfo.infoSrc)
									.replace("#3", data.rows[i].insInfo.chineseName)
									.replace("#4", data.rows[i].insInfo.serial)
									.replace("#5", data.rows[i].control.realname)
									.replace("#6", Status)
									.replace("#7", data.rows[i].id)
									.replace("#8", Status1)
									.replace("#9", data.rows[i].id)
									.replace("#11", data.rows[i].id)
									.replace("#12", data.rows[i].inId)
									.replace("#13", data.rows[i].id)
								html += item;
							}
							//alert(html)
							$("#orderList").html(html);
							$(".delete").each(function(){
								if($(this).parent().parent().next().children().eq(4).children().eq(0).text()!='已关闭'){
									$(this).hide();
								}
								$(this).click(function() {
										var r=confirm("确定要删除吗？");
										if(r==true){
											$.ajax({
												url :Server + "/orderRelevant/deleteOrder",
		 										//url :"http://localhost/orderRelevant/deleteOrder",
												data : {
													"id":$(this).attr("val")
												},
												type : "POST",
												//dataType: "JSON",
												success : function(data) {
													alert(data);
													window.location.reload()
												},
											});	
										}
									});
								});
							$(".operationBtn").each(function(){
								if($(this).text()=="确定"){
									$(this).parent().next().remove();
								}else if($(this).text()==""){
									$(this).parent().next().remove();
									$(this).parent().remove();
								}
							});
						},
						error: function() {
						}
					});	
				}
			
			function findOrder(id){
				$(location).attr('href', 'bookingOrderDetail24?id='+id+'&type=1');
			}
			
			function manageDo(id){
				$(location).attr('href', 'bookingOrderDetail24?id='+id+'&type=2');
			}
			
			$(function() {
				limit = 5;
				offset = 0;
				var sele=1;
				loadPage(sele);
				insOrderCallback(limit,offset,sele);
				$("#timeOption").change(function(){
					sele=$("#timeOption option:selected").val();
					$("#searchBtn").click(function(){	
						loadPage(sele);
						insOrderCallback(limit,offset,sele);	
					});
				});
			});	
			
			Date.prototype.Format = function(fmt){
				var o = {
					"M+": this.getMonth() + 1, //月份 
	       			"d+": this.getDate(), //日 
	        		"h+": this.getHours(), //小时 
	        		"m+": this.getMinutes(), //分 
	        		"s+": this.getSeconds(), //秒 
	        		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
	        		"S": this.getMilliseconds() //毫秒 
				};
				if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for(var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	    		return fmt;
			}
	</script>
<style>
	.myPage {
	margin: 0 auto;
	width: 818px;
	height: 80px;
	font-size: 12px;
	float: right;
	}
	.mainList .content .right .infoList li .row2 .tab1 img {
    width: 100px;
    height: 100px;
    vertical-align: middle;
}











	.pageButton {
	padding: 20px 0 29px 0;
	width: 1200px;
	margin: 0 auto;
	text-align: right;
	}
	.ui-pagination-container {
	clear: both;
	width: 700px;
	height: 100px;
	/* text-align: left; */
	margin-right: 200px;
	position: absolute;
	right: 96px;
	/* float: left; */
	}


	a.ui-pagination-page-item.active12345 {
	width: 35px;
	height: 35px;
	display: inline-block;
	background: #ff8a00;
	text-align: center;
	line-height: 35px;
	color: #fff;
	border-radius: 2px;
	}
	a.ui-pagination-page-item {
	width: 35px;
	text-align: center;
	line-height: 35px;
	border-radius: 2px;
	margin-right: 10px;
	display: inline-block;
	border: 1px solid #ccc;
	}
	a.ui-pagination-page-btn {
	width: 35px;
	height: 35px;
	display: inline-block;
	text-align: center;
	line-height: 35px;
	border-radius: 2px;
	margin-right: 10px;
	margin-left: 10px;
	}



	a.ui-pagination-page-item.nextPage, a.ui-pagination-page-item.prevPage,a.ui-pagination-page-item.endPage, a.ui-pagination-page-item.homePage{
	line-height: 35px;
	/* color: #fff; */
	border-radius: 2px;
	margin-right: 10px;
	/* padding-right: 20px; */
	display: inline-block;
	border: 1px solid #ccc;
	width: 100px;
	}
	</style>
	</body>

</html>